#!/bin/sh

workpath=/home/work/rewrite/src/radoop
app=myradoop
home="/ps/ubs/rank-score/zhaorenyu"
input="/ps/ubs/rank-score/zhaorenyu/20120228/part-0000*"
output="$home/out02/"
pkgpath="$home/$app.tar.gz"

cd $workpath/$app
tar czvf ../$app.tar.gz *
cd $workpath

hadoop fs -test -e $pkgpath && hadoop fs -rm $pkgpath
hadoop fs -put $app.tar.gz $pkgpath

hadoop fs -test -d $output && hadoop fs -rmr $output

hadoop streaming \
    -mapper "python26/bin/python26.sh myradoop/mapper.py" \
    -reducer "python26/bin/python26.sh myradoop/reducer.py" \
    -input $input  \
    -output $output \
    -cacheArchive "/share/python26.tar.gz#python26" \
    -cacheArchive "$pkgpath#myradoop" \
    -jobconf mapred.job.name="rank-score_zry_$app" \
    -jobconf mapred.job.priority=HIGH \
    -jobconf mapred.job.map.capacity=500 \
    -jobconf mapred.job.reduce.capacity=500 \
    -jobconf mapred.map.tasks=500 \
    -jobconf mapred.reduce.tasks=300
